<?php
require_once(dirname(__FILE__) . "/../config/ConfigDB.php");

?>
<!DOCTYPE html>
<html lang="en">

    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

        <title> - 登录</title>
        <meta name="keywords" content="">
        <meta name="description" content="">
        <link href="./public/css/bootstrap.min.css" rel="stylesheet">
        <link href="./public/css/font-awesome.css?v=4.4.0" rel="stylesheet">
        <link href="./public/css/animate.css" rel="stylesheet">
        <link href="./public/css/style.css" rel="stylesheet">
        <link href="./public/css/login.css" rel="stylesheet">
        <!--[if lt IE 9]>
        <meta http-equiv="refresh" content="0;ie.html" />
        <![endif]-->
        <script>
            if (window.top !== window.self) {
                window.top.location = window.location;
            }
        </script>

    </head>

    <body class="signin">
        <div class="signinpanel">
            <div class="row">
                <div class="col-sm-12">
                   
                        <h4 class="no-margins">登录：</h4>
                        <p class="m-t-md">登录到三百山医疗器械管理后台</p>
                        <input type="text" class="form-control uname" id="name" placeholder="用户名" />
                        <input type="password" class="form-control pword m-b" id="password" placeholder="密码" />
                        <!--                    <a href="">忘记密码了？</a>-->
                        <button class="btn btn-success btn-block" id="mylogin">登录</button>
                    
                </div>
            </div>
            <div class="signup-footer">
                <div class="pull-left">
                    &copy; 苏州丸子软件&苏州工业园区服务外包职业学院
                </div>
            </div>
        </div>
    </body>
    <script src="./public/js/jquery.min.js?v=2.1.4"></script>
    <script src="./public/js/plugins/layer/layer.min.js"></script>
</html>

<script type="text/javascript">

            $(function () {
               
            });


            $("#mylogin").click(function () {
                var username = $("#name").val();
                var password = $("#password").val();
                if (username == "" || password == "") {
                    layer.msg('请填写用户名或密码', {
                        time: 2000, //2s后自动关闭
                        btn: ['OK']
                    });
                    return;
                }
                var datastr = "username=" + username + "&password=" + password;
                $.ajax({
                    type: "post",
                    url: "/../../controller/logincontroller.php",
                    data: datastr,
                    success: function (e) {
                        var result = eval("(" + e + ")");
                        console.log(e);
                        if (result.code == 0) {
                            window.location = "index.html";
                        } else {
                            layer.msg('密码错误', {
                                time: 2000, //2s后自动关闭
                                btn: ['OK']
                            });
                        }
                        return;
                    }
                });
            });

</script>
